Skip to content

Conversation

@chirpxiv
Copy link
Contributor

apricot is a nice fruit

@github-actions github-actions bot added the requested changes Changes requested through comments label Dec 13, 2025
public struct RgbFunctionCurve {
[FieldOffset(0x0)] public uint Data;
// not a fixed size array, not sure how else to handle this?
[FieldOffset(0x4), FixedSizeArray] internal unsafe fixed byte _keys[0x10];
Copy link
Collaborator

@Haselnussbomber Haselnussbomber Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you were looking for was FixedSizeArray2<Pointer<RgbKey>>.
But in this case, with a dynamic sized array, it probably won’t help much.

Copy link
Collaborator

@wolfcomp wolfcomp Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do

[FieldOffset(0x4)] public RgbKey* KeyPointer;

public Span<RgbKey> Keys => new Span(KeyPointer, KeyCount);

with looking at how the GetKey function works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you were looking for was FixedSizeArray2<Pointer<RgbKey>>. But in this case, with a dynamic sized array, it probably won’t help much.

Originally tried this with a FixedSizeArray1, but it throws a IndexOutOfRangeException beyond the first element.

Could do

[FieldOffset(0x4)] public RgbKey* KeyPointer;

public Span<RgbKey> Keys => new Span(KeyPointer, KeyCount);

with looking at how the GetKey function works

There isn't a pointer here, it's an inline array with a dynamic size.

@github-actions github-actions bot removed the requested changes Changes requested through comments label Dec 13, 2025
Comment on lines +5 to +7
[FieldOffset(0), CExporterUnion("Value")] public ulong Value;
[FieldOffset(0), CExporterUnion("Value")] public uint Id;
[FieldOffset(4), CExporterUnion("Value")] public uint Index;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will export the unions as

union Value {
  uint64_t Value;
  uint32_t Id;
  uint32_t Index;
}

all which are at field offset 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants